#include "BrandFactory.h"

#include <iostream>

using std::cout;
using std::endl;

BrandFactory::BrandFactory()
{

}

BrandFactory::~BrandFactory()
{

}

Brand* BrandFactory::GetBrand(const string& key)
{
	vector<Brand*>::iterator it = _brands.begin();

	for (; it != _brands.end(); ++it)
	{
		if ((*it)->GetKey() == key)
		{
			cout << "Already created." << endl;

			return *it;
		}
	}

	Brand* brand = new MobileBrand(key);

	_brands.push_back(brand);

	return brand;
}